HREF Button Details

HREFButton and HREFiButton are related Java(tm) classes that provide an alternative to using still bitmaps or html forms when an html author wishes to attach a URL link to a graphical button. HREFButton creates a simple button without any custom images, while HREFiButton creates a simple button first, but then replaces it with a button created using two supplied images. The simple button is only displayed while the images are loaidng to prevent a blank area in the document. The classes are distributed with two sample applets that can be used unmodified to place buttons on a web page.

To download the HREF Buttons, you must first read the license agreement.


HREFButtonApplet Usage

There are two sample applets, one uses HREFButton, the other uses HREFiButton. To use these applets, place the appropriate one and it's matching HREFButton .class file on your web site and include an <APPLET> tag on your web page.

HREFButtonApplet.class requires HREFButton.class while HREFiButtonApplet.class requires HREFiButton.class.

The syntax for HREFButtonApplet is:

<Applet codebase="LOCATION" code="HREFButtonApplet.class" 
        width=AWIDTH height=AHEIGHT>
<PARAM name="label" value="ALABEL">
<PARAM name="href" value="URL">
<PARAM name="frame" value="URLFRAME">
</APPLET>
LOCATION (optional)
the location of the .class files if they are not in the document's directory.
AWIDTH
the width=of the button.
AHEIGHT
the height of the button.
ALABEL
the label to appear on the button.
URL
the URL to be loaded by the browser when the button is pressed. This URL can either be relative to the current document or an absolute reference.
URLFRAME (optional)
the frame in which the URL should be loaded when viewed with a frames capable browser. The value of URLFRAME can be any valid browser frame target name including internal ones such as _blank for a new window.

The syntax for HREFiButtonApplet is the same as HREFButtonApplet except that code="HREFiButtonApplet.class", PARAM name="label" is used for a temporary button while the images are loading and there are two additional required parameters:

<PARAM name="upImage" value="UP.GIF">
<PARAM name="downImage" value="DOWN.GIF">
UP.GIF
the filename of the bitmap (gif or jpg) to display when the button is in the normal state. This name is relative to the location of the document.
DOWN.GIF
the filename of the bitmap (gif or jpg) to display when the button is in the pressed state. This name is relative to the location of the document.

Some alternate html text should also be included within the <APPLET> and </APPLET&ggt tags to provide an alternative for users with non-Java capable browsers.


HREFButton .class Usage

HREFButton.class and HREFiButton.class are classes that can be used in other Java(tm) applets. To use one of these in an applet, simply include the .class file in you CLASSPATH and use it as AWT objects are used. The only public methods are a single constructor for each class, however since they are derived AWT components all Component methods are available. (The current release is actually derived from Frame, however a future release may be drived directly from Component.)

The source for HREFButtonApplet and HREFiButtonApplet are included as examples.

Constructors

 o HREFButton
  public HREFButton(Applet parent,
                    String href,
                    String frame,
                    String label)
Constructs an HREFButton with a string label and string href.
Parameters:
parent - The applet creating this HREFButton.
href - String form of the relative or absolute URL to be loaded when the button is pressed.
frame - The name of the frame where the URL is to be displayed. If null the URL will be loaded in the current browser window.
label - The label to be displayed on the button.
 o HREFiButton
  public HREFiButton(Applet parent,
                     String href,
                     String frame,
                     String label,
                     String upImage,
                     String downImage)
Constructs an HREFiButton with a string href using upImage and downImage.
Parameters:
parent - The applet creating this HREFButton.
href - String form of the relative or absolute URL to be loaded when the button is pressed.
frame - The name of the frame where the URL is to be displayed. If null the URL will be loaded in the current browser window.
label - The label to be displayed on the button while the images are loading.
upImage - The name of the image file to be displayed when the button is in the normal state.
downImage - The name of the image file to be displayed when the button is in the pressed state.

To download the HREF Buttons, you must first read the license agreement.


Last Updated: June 23, 1996
©L. Todd Lowe,
ltlowe@achilles.net